package com.loong.shop.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.shop.common.forehead.param.GoodsSizeValueQueryForeheadParam;
import com.loong.shop.handler.GoodsSpecificationValueHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/*
 * @Description: 处理前台商品规格值请求的Controller
 * @Author: 刘群
 * @Date: 2020/10/27 8:55
 */
@RestController
@RequestMapping("forehead/shop/specificationValue")
public class GoodsSizeValueForeheadController extends BaseForeheadController {

    @Resource
    private GoodsSpecificationValueHandler valueHandler;

    /**
     * 查询商品规格值
     * @param param 查询参数
     * @return 响应的结果
     */
    @PostMapping("query")
    public Result findSpecificationValueByParam(@RequestBody @Validated({CommonValidate.class}) GoodsSizeValueQueryForeheadParam param){
        return handlerExecutor.execute(() -> valueHandler.findGoodsSizeValueToForehead(param));
    }


}
